<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Contact extends CI_Controller
	{
		public function __construct()
		{
            parent::__construct();
		}
		
		public function index()
		{
			$dataObj = new DataObject();
			$dataObj->SetTitle(getContactViewTitle());
			$dataObj->SetContent(getContactViewUrl());
			
			// Validation rules , moved to separate config
						
			if(!$this->form_validation->run() == FALSE)
			{
				// Loading email library and sending with provided data, determine view
				// Config used for email preferences re-located to config directory
				$this->load->library('email');
				
				$this->email->from(getContactEmail(), 'SupportRelated');
				$this->email->to('calleviktor@telia.com');
				$this->email->subject(getHeadlineEmail());
				$this->email->message(getMessageEmail());
				if($this->email->send())
				{
					$dataObj->SetTitle(getContactViewSuccessTitle());
					$dataObj->SetContent(getContactViewSuccessUrl());
				}
			}
			
			$this->load->view(index_page(), array($dataObj->GetName() => $dataObj));
		}
		
	}